﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace PrinteMaster
{
    public partial class 确认交接班收款 : Form
    {
        public 确认交接班收款()
        {
            InitializeComponent();
        }
        DataSet req;
        private void 确认交接班收款_Load(object sender, EventArgs e)
        {
            
            DataBase.Error er = DataBase.getInstance().selectTable("员工交接班", "where 是否收款='未收款'", out req);
            dgv.DataSource = req.Tables[0].DefaultView;
        }

        private void dgv_MouseUp(object sender, MouseEventArgs e)
        {
            if (e.Button == System.Windows.Forms.MouseButtons.Right)
            {
                if (MessageBox.Show("是否确认收款?", "", MessageBoxButtons.OKCancel) == System.Windows.Forms.DialogResult.OK)
                {
                    try
                    {
                        var str = this.req.Tables[0].Rows[dgv.CurrentRow.Index][0].ToString();
                        DataBase.getInstance().updateManagerExitState(str);
                        MessageBox.Show("确认成功!");
                        DataBase.Error er = DataBase.getInstance().selectTable("员工交接班", "where 是否收款='未收款'", out req);
                        dgv.DataSource = req.Tables[0].DefaultView;    
                    }
                    catch (Exception ex) { Console.Write(ex.Message); MessageBox.Show("数据库错误，错误原因=>" + ex.Message); }

                }
            }
        }
    }
}
